/**
 *
 * @author 
 *
 */
class GameMap extends egret.Sprite{
    
    private map: egret.Sprite;
    
	public constructor() {
    	super();
    	this.init();
	}
	
    private init(): void
    {

        this.map = new egret.Sprite;
        this.addChild(this.map);

        this.touchEnabled = true;

        this.loadMap();
    }

    private loadMap(): void
    {
        RES.addEventListener(RES.ResourceEvent.GROUP_COMPLETE, this.onMapComplete, this);
        RES.loadConfig("resource/resource.json", "resource/");
        RES.loadGroup("map");
    }

    private onMapComplete(): void
    {
        for(var x: number = 0; x < 5; x++)
        {
            for(var y: number = 0; y < 10; y++)
            {
                var txtr: egret.Texture = RES.getRes("map.m" + (x + 1) + "_" + (y + 1));
                var img: egret.Bitmap = new egret.Bitmap(txtr);
                img.x = 224 * x;
                img.y = 112 * y;
                this.map.addChild(img);
            }
        }
    }
    
}
